#include <stdio.h>
#include <math.h>
int main(void){
	int m,n,x,y,a,b,c;
	scanf("%d%d",&m,&n);
	for(x=m;x<=n;x++){
		a=x/100;
		b=(x%100)/10;
		c=x%10;
		y=a*a*a+b*b*b+c*c*c;
		if(x==y){
			printf("%d\n",x);
		}
	}
	return 0;
}